/**
 * 【程序21】   
 * 题目：求1+2!+3!+...+20!的和   
 */
public class test21 {
    public static void main(String[] args) {
        double sum = 0;
        for (int i = 1; i <= 20; i++) {
            double func = 1;
            for (int j = 1; j <= i; j++) {
                func = func * j;
            }
            sum = sum + func;
        }
        System.out.println(sum);
    }
}
